<?php
/**
 * // +----------------------------------------------------------------------
 * //            -------------------------
 * //           /   / ------------------\  \
 * //                                          \  \
 * //                                           /  /
 * //          /  /  ------------------- /  /
 * //        /  /  ----------------------
 * //      /  /
 * //      \  \
 * //        \  \  ------------------ /  /
 * //          \  \--------------------/
 * // +----------------------------------------------------------------------
 * // | Copyright (c) 2016 Sage  All rights reserved.
 * // +----------------------------------------------------------------------
 * // | Author: Sage
 * // +----------------------------------------------------------------------
 *
 */

namespace KysbsUtils\Traits;
/**
 * Created by PhpStorm.
 * User: Sage
 * Date: 2017/7/28
 * Time: 11:58
 */
trait SingletonTrait {
    static private $instance;
    /**
     * 私有化构造方法
     * SingletonTrait constructor.
     */
    private function __construct() {
    }
    /**
     * 私有化克隆方法
     */
    private function __clone() {
        // TODO: Implement __clone() method.
    }
    /**
     * 获取单例类
     * @return SingletonTrait
     */
    static function getInstance(){
        if(is_null(self::$instance)){
            self::$instance=new static();
        }
        return self::$instance;
    }
}